Skip to content

Add GitHub Actions workflow for Xcode build and analyze#1

Open
wvnr5m6h4r-commits wants to merge 1 commit into
jackrex:masterfrom
wvnr5m6h4r-commits:wvnr5m6h4r-commits-patch-1
Open

Add GitHub Actions workflow for Xcode build and analyze#1
wvnr5m6h4r-commits wants to merge 1 commit into
jackrex:masterfrom
wvnr5m6h4r-commits:wvnr5m6h4r-commits-patch-1

Conversation

@wvnr5m6h4r-commits

@wvnr5m6h4r-commits wvnr5m6h4r-commits commented Jul 10, 2026

Copy link
Copy Markdown

CMakeLists.txt

Summary by CodeRabbit

  • Chores
    • Added automated macOS build validation for pushes and pull requests.
    • Builds, cleans, and analyzes the project using the default Xcode scheme.
    • Supports both Xcode workspaces and projects, with formatted build output.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Xcode CI workflow

Layer / File(s) Summary
Workflow triggers and macOS job
.github/workflows/objective-c-xcode.yml
Runs the workflow for pushes and pull requests targeting master on macos-latest.
Scheme discovery and Xcode validation
.github/workflows/objective-c-xcode.yml
Detects the default scheme, selects an Xcode workspace or project, and runs clean, build, and analyze commands through xcpretty.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant xcodebuild
  participant xcpretty
  GitHubActions->>xcodebuild: List projects and schemes
  xcodebuild-->>GitHubActions: Return project metadata
  GitHubActions->>xcodebuild: Run clean build analyze
  xcodebuild->>xcpretty: Pipe build output
  xcpretty-->>GitHubActions: Return pipeline status
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the new GitHub Actions workflow that builds and analyzes the Xcode project.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
.github/workflows/objective-c-xcode.yml (2)

15-16: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Set persist-credentials: false on the checkout step.

actions/checkout@v4 persists the GITHUB_TOKEN in .git/config by default. Since this workflow only builds and analyzes—no pushes or commits—retaining credentials is an unnecessary exposure surface. Disable it explicitly.

🔒️ Proposed fix
       - name: Checkout
         uses: actions/checkout@v4
+        with:
+          persist-credentials: false
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/objective-c-xcode.yml around lines 15 - 16, Update the
checkout step using actions/checkout@v4 to set persist-credentials: false,
ensuring the workflow does not retain the GITHUB_TOKEN in the repository
configuration.

Source: Linters/SAST tools


25-25: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Simplify the obfuscated scheme env value.

${{ 'default' }} always evaluates to the literal string default. This is unnecessarily indirect and obscures intent. Use a plain string.

♻️ Proposed fix
       - name: Build
         env:
-          scheme: ${{ 'default' }}
+          scheme: default
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/objective-c-xcode.yml at line 25, Replace the indirect
expression assigned to the workflow’s scheme setting with the plain string value
default, preserving the existing behavior while making the intent explicit.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/objective-c-xcode.yml:
- Around line 17-22: In the “Set Default Scheme” step, quote the shell
expansions for scheme_list and default to prevent word splitting, and replace
the piped echo/cat file write with a direct, appropriately quoted write to the
default file. Preserve the existing scheme parsing and log output.
- Around line 27-30: In the workflow’s scheme and build-file selection logic,
quote all variable expansions, especially in the `if` test and `file_to_build`
handling, to preserve paths containing spaces. Replace the dense
workspace/project detection command with clear, readable logic that explicitly
selects the intended `.xcworkspace` or `.xcodeproj` and fails when multiple or
no matches exist; update the `xcodebuild` invocation to use the quoted
variables.

---

Nitpick comments:
In @.github/workflows/objective-c-xcode.yml:
- Around line 15-16: Update the checkout step using actions/checkout@v4 to set
persist-credentials: false, ensuring the workflow does not retain the
GITHUB_TOKEN in the repository configuration.
- Line 25: Replace the indirect expression assigned to the workflow’s scheme
setting with the plain string value default, preserving the existing behavior
while making the intent explicit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 32e6297f-e329-466d-8a47-b5d21d16c215

📥 Commits

Reviewing files that changed from the base of the PR and between 908cdd4 and c231854.

📒 Files selected for processing (1)
  • .github/workflows/objective-c-xcode.yml

Comment thread .github/workflows/objective-c-xcode.yml
Comment on lines +27 to +30
if [ $scheme = default ]; then scheme=$(cat default); fi
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
xcodebuild clean build analyze -scheme "$scheme" -"$filetype_parameter" "$file_to_build" | xcpretty && exit ${PIPESTATUS[0]}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Quote variables and simplify the workspace/project detection.

$scheme and $file_to_build are unquoted, risking word-splitting on paths with spaces. The one-liner on line 28 is hard to parse and will silently pick the first match if multiple .xcworkspace or .xcodeproj files exist.

🛡️ Proposed fix
         run: |
-          if [ $scheme = default ]; then scheme=$(cat default); fi
-          if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
-          file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
-          xcodebuild clean build analyze -scheme "$scheme" -"$filetype_parameter" "$file_to_build" | xcpretty && exit ${PIPESTATUS[0]}
+          if [ "$scheme" = "default" ]; then scheme=$(cat default); fi
+          if [ -n "$(ls -A | grep -i '\.xcworkspace$')" ]; then
+            filetype_parameter="workspace"
+            file_to_build="$(ls -A | grep -i '\.xcworkspace$' | head -1)"
+          else
+            filetype_parameter="project"
+            file_to_build="$(ls -A | grep -i '\.xcodeproj$' | head -1)"
+          fi
+          file_to_build="$(echo "$file_to_build" | awk '{$1=$1;print}')"
+          xcodebuild clean build analyze -scheme "$scheme" -"$filetype_parameter" "$file_to_build" | xcpretty && exit ${PIPESTATUS[0]}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [ $scheme = default ]; then scheme=$(cat default); fi
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
xcodebuild clean build analyze -scheme "$scheme" -"$filetype_parameter" "$file_to_build" | xcpretty && exit ${PIPESTATUS[0]}
if [ "$scheme" = "default" ]; then scheme=$(cat default); fi
if [ -n "$(ls -A | grep -i '\.xcworkspace$')" ]; then
filetype_parameter="workspace"
file_to_build="$(ls -A | grep -i '\.xcworkspace$' | head -1)"
else
filetype_parameter="project"
file_to_build="$(ls -A | grep -i '\.xcodeproj$' | head -1)"
fi
file_to_build="$(echo "$file_to_build" | awk '{$1=$1;print}')"
xcodebuild clean build analyze -scheme "$scheme" -"$filetype_parameter" "$file_to_build" | xcpretty && exit ${PIPESTATUS[0]}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/objective-c-xcode.yml around lines 27 - 30, In the
workflow’s scheme and build-file selection logic, quote all variable expansions,
especially in the `if` test and `file_to_build` handling, to preserve paths
containing spaces. Replace the dense workspace/project detection command with
clear, readable logic that explicitly selects the intended `.xcworkspace` or
`.xcodeproj` and fails when multiple or no matches exist; update the
`xcodebuild` invocation to use the quoted variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant